<template>
	<view>
		<TabBar :activeIndex="1"></TabBar>
		<view class="right-content">
			<view class="tit">
				<u-icon class="back" size="24" name="/static/img/arrow-left.svg" @click="goBack"></u-icon>
				{{voteResult.meetingReviewItems}}的表决结果
			</view>
			<view class="charts-box">
				<view class="result">
					{{voteResult.meetingReviewItems}}的表决结果为：<text>{{voteResult.result}}</text>
				</view>
				<view class="charts">
					<qiun-data-charts
						type="column"
						:chartData="chartData"
						background="none"
					/>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chartData:{
				  categories:["同意","反对","弃权"],
				  series:[],
				},
				voteResult:{}
			}
		},
		methods: {
			/* 获取某个议题的表决结果 */
			async getVoteResultById (id) {
				// const res = await request({
				// 	url: '/api/meeting/getVoteResultById/'+id
				// }).then(response => {
				// 	this.voteResult = response.data
				// })
				this.voteResult = {
					id:1,
					meetingReviewItems:"关于xxx的议题1",
					voteNum:"9",
					agreeNum:"30",
					opposeNum:"1",
					waiverNum:"2",
					result:"通过"
				}
				this.chartData.series = [{"name": "票数",
					"data": [
						this.voteResult.agreeNum,
						this.voteResult.opposeNum,
						this.voteResult.waiverNum
					]
				}]
			},
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			}
		},
		onLoad (options) {
			this.id = options.id
			this.getVoteResultById(options.id)
		}
	}
</script>

<style lang="scss">
	@import "@/static/css/_px2vw.scss";
	.tit{
		width: 100%;
		height: vw(50);
		text-align:center;
		background-color:rgb(64,158,255);
		line-height: vw(50);
		font-size:vw(20);
		color:#FFFFFF;
		font-family:'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
		font-weight:700;
		font-style:normal;
		.back{
			height: vw(50);
			line-height: vw(50);
			margin-left: vw(15);
			float:left;
		}
	}
	.charts-box{
		margin-top: vw(68);
		margin-left: vw(42);
		.result{
			font-size:vw(28);
			font-family:'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
			text{
				color: green;
				font-size: vw(32);
				font-weight:700;
			}
		}
		.charts{
			margin-top: vw(58);
		}
	}
</style>
